const getDefaultState=()=>{
	return {
		loginStatus:false,
		userInfo:{},
		access_token:'',
		refresh_token:''
	}
}
const state=getDefaultState()

const mutations={
	UserLogin:(state,provider)=>{
		debugger
		state.loginStatus=true,
		state.userInfo=provider.userInfo,
		state.access_token=provider.access_token,
		state.refresh_token=provider.refresh_token,
		uni.setStorage({
			key:"userInfo",
			data:provider.userInfo
		})
		uni.setStorage({
			key:"access_token",
			data:provider.access_token
		})
		uni.setStorage({
			key:"refresh_token",
			data:provider.refresh_token
		})
	}
}
const actions={
	login:(context,payload)=>{
		context.commit('login',payload)
	}
}
export default{
	namespaced: true,//表示引用命名空间，如果不使用这个，那么commit就只能通过store.commit('UserLogin',{access_token:'at',refresh_token:'rt',userInfo:{nickName:'gavin'}})
	state,
	mutations,
	actions
}